package com.cloud.drore.eboss.supplier.mapper.provider;

import com.cloud.drore.eboos.common.entity.supplier.TicketPrice;

/**
 * 浙江卓锐科技股份有限公司 版权所有  Copyright 2018<br>
 *
 * @Description: <br>
 * @Project: eboos <br>
 * @CreateDate: Created in 2018/1/11 13:51 <br>
 * @Author: <a href="575842778@qq.com">郑永涛</a>
 */
public class TicketPriceProvider {

    public TicketPriceProvider(){
    }

    private static String selectByParamSql = "select id,ticket_id,sales_price,settlement_price,start_time,end_time" +
            " from eboos_ticket_price where is_deleted = '0' ";

    public String updateTicketPriceByTicketId(TicketPrice price){
        int count = 0;
        String sql = " update eboos_ticket_price set ";
        if (price.getSettlementPrice()!=null) {
            sql += " settlement_price =" + price.getSettlementPrice() + "";
            count++;
        }
        sql += " where ticket_id='" + price.getTicketId() + "'";
        return sql;
    }


    public String selectByParam(TicketPrice price){
        String sql = selectByParamSql;
        if(price.getId() != null)
            sql += " and id = " + price.getId() + "";
        if(price.getTicketId() != null)
            sql += " and ticket_id = " + price.getTicketId() + "";
        return sql;
    }
}